package com.zking.frame;

import com.zking.utils.Tool工具;

import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.border.MatteBorder;

/*商家展示页面*/
public class SweetMilkTea {

	private JPanel jpanel;// 面板
	private JLabel jlable;// 文本标签
	private JScrollPane jScrollPane;// 滚动面板

	public SweetMilkTea(JFrame a,String sort) {

		a.dispose();
		JFrame jFrame = Tool工具.getJFrame();

		//设置背景
		ImageIcon icon = new ImageIcon(HomePage.class.getResource("jf.jpg"));
		JLabel jLabel = new JLabel(icon);
		jLabel.setBounds(0,0,645,900);
		jFrame.add(jLabel,-1);

		jlable = new JLabel("返回首页", 0);
		jlable.setFont(new Font("黑体", Font.BOLD, 20));
		jlable.setBounds(30, 20, 100, 50);
		jlable.setCursor(new Cursor(Cursor.HAND_CURSOR));
		jlable.setBorder(new MatteBorder(2, 2, 2, 2, new Color(254, 253, 129)));
		// 设置点击事件
		jlable.addMouseListener(new MouseAdapter() {
			public void mouseClicked(MouseEvent e) {
				if (e.getClickCount() == 1) {
					new HomePage(jFrame);
				}
			}
		});
		jFrame.add(jlable, 0);

		// 获取商铺的内容
		JPanel jPanel =Tool工具.getjpShops(sort, jFrame);
		jpanel = new JPanel();
		jpanel.setPreferredSize(new Dimension(590, 1460));
		jpanel.setLayout(null);
		jpanel.add(jPanel);
		jScrollPane = new JScrollPane(jpanel);// 滚动框面板
		jScrollPane.setBounds(10, 80, 615, 870);
		jFrame.add(jScrollPane, 0);
		// 加载并刷新面板
		jFrame.repaint();
		jFrame.revalidate();

	}
}
